<?php
/**
 * Created by PhpStorm.
 * Admininfo: Administrator
 * Date: 2017/12/12
 * Time: 11:23
 */

namespace app\admin\controller;

use app\common\controller\Curt;
use app\admin\model\Menu as menmodel;
use Library\Utils;

class Menu extends  Curt
{
    public function __construct($upload = false, array $uploadsConfig = ['input_name' => 'coverFile', 'data_field' => 'cover'])
    {
        parent::__construct($upload, $uploadsConfig);
    }

    public function getall()
    {
        $menmodel=new menmodel();
        $list= $menmodel->select();
        $list=collection($list)->toArray();
        $list = Utils::toTree($list,'menu_id');
        $this->assign('list',$list);
    }
    public function showAdd()
    {
        $menmodel=new menmodel();
        $list= $menmodel->select();
        $list=collection($list)->toArray();
        $list = Utils::toTree($list,'menu_id');
        $this->assign('list',$list);
        return parent::showAdd(); // TODO: Change the autogenerated stub
    }
}